#!/bin/sh
case "$1" in
  start)
    echo "SOFTWARE_VERSION=$(cat /etc/version)" | logos system
    nice upload-logs-loop 2>&1 | logos upload-crash-log &
    ;;
  stop)
    # Should really just kill upload-logs-loop, but pkill can only recognize
    # the first several letters of an exe name.  So let's use the name prefix
    # instead and kill both upload-logs and upload-logs-loop.
    pkillwait upload-logs
    pkillwait log-delay
    pkillwait upload-crash
    ;;
  restart|reload)
    $0 stop; $0 start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac
